<template>
  <div class="detailPageCss">
    <div class="titleCss">处方权限授权</div>
    <div class="bodyCss">
      <el-form ref="form" :model="formData" label-width="120px">
          <el-form-item label="授权医师名称">
            <el-input v-model="formData.data1" placeholder="请输入"></el-input>
          </el-form-item>
          <el-form-item label="授权内容">
            <el-select v-model="formData.data2" placeholder="请选择" style="width:100%;">
              <el-option
                v-for="item in data2Options"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="是否取的麻精药品印鉴卡">
            <el-radio-group v-model="formData.data3">
              <el-radio :label="0">是</el-radio>
              <el-radio :label="1">否</el-radio>
            </el-radio-group>
          </el-form-item>
          <div class="formBtnCss">
            <el-button type="primary" @click="searchBtn">查询</el-button>
            <el-button @click="resetBtn">重置</el-button>
          </div>
      </el-form>
      <div class="tableCss">
        <el-table
          max-height="550"
          :data="tableData"
          border
          style="width: 100%">
          <el-table-column
            type="index"
            label="序号"
            width="55"
            align="center">
          </el-table-column>
          <el-table-column
            prop="data1"
            label="授权医师名称"
            min-width="100">
          </el-table-column>
          <el-table-column
            prop="data2"
            label="授权内容"
            min-width="300">
          </el-table-column>
          <el-table-column
            fixed="right"
            label="操作"
            width="100">
            <template #default="scope">
              <el-button @click="lookAuthBookBtn(scope.row)" type="text" size="small">查看授权书</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          style="margin-top:10px;text-align: right;"
          background
          :pageSize="pageSize"
          layout="prev, pager, next"
          :page-sizes="[10, 20, 50]"
          :total="total"
          @sizeChange="handleSizeChange"
          @currentChange="handleCurrentChange">
        </el-pagination>
      </div>
    </div>
    <div class="bottomBtnCss">
      <el-button @click="goBackBtn">返回</el-button>
    </div>
  </div>
</template>

<script>
import { getSelectOptionsFun } from '@/utils/business.js'
export default {
  data(){
    return{
      formData:{
        data1:null,
        data2:null,
        data3:null,
      },
      data2Options:[],
      tableData:[],
      pageSize:10,
      total:1000,
    }
  },
  mounted(){
    this.data2Options = getSelectOptionsFun()
    this.getList()
  },
  methods:{
    lookAuthBookBtn(row){

    },
    getList(){
      const random = Math.floor( Math.random() * 50 ) + 4
      let list = []
      for( let i=0;i<random;i++){
        list.push({
          data1:'张三',
          data2:'【测试数据】抗菌药品授权、麻醉药品授权、疫苗授权、手术4级授权',
        })
      }
      this.tableData = list
    },
    handleCurrentChange(){
      
    },
    handleSizeChange(){
      
    },
    resetBtn(){

    },
    searchBtn(){
      
    },
    goBackBtn(){
      this.$router.back()
    },
  },
}
</script>

<style lang="scss" scoped>
.detailPageCss{
  overflow: hidden;
  position: relative;
  background-color: #fff;
  padding: 20px;
  border-radius: 10px;
  height: calc( 100vh - 66px - 40px);
  display: flex;
  flex-direction: column;
  .titleCss{
    text-align: center;
    font-size: 18px;
    font-weight: bold;
  }
  .bodyCss{
    margin-top: 20px;
    width: calc( 100% - 20px);
    margin-left: 10px;
    .el-form{
      display: flex;
      flex-wrap: wrap;
      border-bottom: 1px solid #f2f2f2;
      .formBtnCss{
        margin-left: 20px;
        text-align: center;
      }
    }
  }
  .bottomBtnCss{
    margin-top: auto;
    text-align: right;
  }
}
::v-deep .el-form-item__content{
  width: 200px;
}
</style>